package com.own.business.wechat.mobile.handler;

import com.own.business.wechat.mobile.exception.WechatMobileException;
import com.own.component.common.model.ExceptionMessageModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * WechatMobileExceptionHandler
 *
 * @author chenxueli
 * @date 2023-06-30 10:39:29
 */
@Slf4j
@Order(1)
@RestControllerAdvice
public class WechatMobileExceptionHandler {

    /**
     * 处理 WechatMobileException 异常
     *
     * @param e 异常信息
     * @return 返回信息
     */
    @ExceptionHandler(WechatMobileException.class)
    public ExceptionMessageModel handleException(WechatMobileException e) {
        log.error(e.getMessage());
        return new ExceptionMessageModel(e);
    }

}
